/*
 * Copyright (C) 2021 Realtek Semiconductor Corp.
 * All Rights Reserved.
 *
 * This program is the proprietary software of Realtek Semiconductor
 * Corporation and/or its licensors, and only be used, duplicated,
 * modified or distributed under the authorized license from Realtek.
 *
 * ANY USE OF THE SOFTWARE OTHER THAN AS AUTHORIZED UNDER
 * THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
 *
 * Purpose : Definition of ME attribute: ONU dynamic power management control (336)
 *
 * Feature : The file includes the following modules and sub-modules
 *           (1) ME handler: ONU dynamic power management control (336)
 */

#ifndef __MIB_ONU_DYNA_PWR_MGMT_CTRL_TABLE_H__
#define __MIB_ONU_DYNA_PWR_MGMT_CTRL_TABLE_H__

#ifdef __cplusplus
extern "C" {
#endif


/* Table ONU_DYNA_PWR_MGMT_CTRL attribute index */
#define MIB_TABLE_ONU_DYNA_PWR_MGMT_CTRL_2014_ATTR_NUM (13)
#define MIB_TABLE_ONU_DYNA_PWR_MGMT_CTRL_2014_ENTITY_ID_INDEX ((MIB_ATTR_INDEX)1)
#define MIB_TABLE_ONU_DYNA_PWR_MGMT_CTRL_2014_PWR_REDUCTION_MGMT_CAPABILITY_INDEX ((MIB_ATTR_INDEX)2)
#define MIB_TABLE_ONU_DYNA_PWR_MGMT_CTRL_2014_PWR_REDUCTION_MGMT_MODE_INDEX ((MIB_ATTR_INDEX)3)
#define MIB_TABLE_ONU_DYNA_PWR_MGMT_CTRL_2014_ITRANSINIT_INDEX ((MIB_ATTR_INDEX)4)
#define MIB_TABLE_ONU_DYNA_PWR_MGMT_CTRL_2014_ITXINIT_INDEX ((MIB_ATTR_INDEX)5)
#define MIB_TABLE_ONU_DYNA_PWR_MGMT_CTRL_2014_MAX_SLEEP_INTERVAL_INDEX ((MIB_ATTR_INDEX)6)
#define MIB_TABLE_ONU_DYNA_PWR_MGMT_CTRL_2014_MAX_RECEVER_OFF_INTERVAL_INDEX ((MIB_ATTR_INDEX)7)
#define MIB_TABLE_ONU_DYNA_PWR_MGMT_CTRL_2014_MIN_AWARE_INTERVAL_INDEX ((MIB_ATTR_INDEX)8)
#define MIB_TABLE_ONU_DYNA_PWR_MGMT_CTRL_2014_MIN_ACTIVE_HELD_INTERVAL_INDEX ((MIB_ATTR_INDEX)9)
#define MIB_TABLE_ONU_DYNA_PWR_MGMT_CTRL_2014_MAX_SLEEP_INTERVAL_EXTENSION_INDEX ((MIB_ATTR_INDEX)10)
#define MIB_TABLE_ONU_DYNA_PWR_MGMT_CTRL_2014_EPON_CAPABILITY_EXTENSION_INDEX ((MIB_ATTR_INDEX)11)
#define MIB_TABLE_ONU_DYNA_PWR_MGMT_CTRL_2014_EPON_SETUP_EXTENSION_INDEX ((MIB_ATTR_INDEX)12)
#define MIB_TABLE_ONU_DYNA_PWR_MGMT_CTRL_2014_MISSING_CONSECUTIVE_BURSTS_THRESHOLD_INDEX ((MIB_ATTR_INDEX)13)

#define MIB_TABLE_ONU_DYNA_PWR_MGMT_CTRL_ATTR_NUM (9)
#define MIB_TABLE_ONU_DYNA_PWR_MGMT_CTRL_ENTITY_ID_INDEX ((MIB_ATTR_INDEX)1)
#define MIB_TABLE_ONU_DYNA_PWR_MGMT_CTRL_PWR_REDUCTION_MGMT_CAPABILITY_INDEX ((MIB_ATTR_INDEX)2)
#define MIB_TABLE_ONU_DYNA_PWR_MGMT_CTRL_PWR_REDUCTION_MGMT_MODE_INDEX ((MIB_ATTR_INDEX)3)
#define MIB_TABLE_ONU_DYNA_PWR_MGMT_CTRL_ITRANSINIT_INDEX ((MIB_ATTR_INDEX)4)
#define MIB_TABLE_ONU_DYNA_PWR_MGMT_CTRL_ITXINIT_INDEX ((MIB_ATTR_INDEX)5)
#define MIB_TABLE_ONU_DYNA_PWR_MGMT_CTRL_MAX_SLEEP_INTERVAL_INDEX ((MIB_ATTR_INDEX)6)
#define MIB_TABLE_ONU_DYNA_PWR_MGMT_CTRL_MIN_AWARE_INTERVAL_INDEX ((MIB_ATTR_INDEX)7)
#define MIB_TABLE_ONU_DYNA_PWR_MGMT_CTRL_MIN_ACTIVE_HELD_INTERVAL_INDEX ((MIB_ATTR_INDEX)8)
#define MIB_TABLE_ONU_DYNA_PWR_MGMT_CTRL_MAX_SLEEP_INTERVAL_EXTENSION_INDEX ((MIB_ATTR_INDEX)9)


typedef enum {
    ONU_PWR_CTRL_CAPABILITY_DOZE            = 1 << 0,
    ONU_PWR_CTRL_CAPABILITY_CYCLIC_SLEEP    = 1 << 1,
    ONU_PWR_CTRL_CAPABILITY_WATCHFUL_SLEEP  = 1 << 2
} onu_pwr_ctrl_attr_capability_t;




/* Table ONU_DYNA_PWR_MGMT_CTRL attribute len, only string attrubutes have length definition */
typedef struct {
    UINT16   EntityId;
    UINT8    PwrReductionMgmtCapability;
    UINT8    PwrReductionMgmtMode;
    UINT16   Itransinit;
    UINT16   Itxinit;
    UINT32   MaxSleepInterval;
    UINT32   MaxReceiverOffInterval;
    UINT32   MinAwareInterval;
    UINT16   MinActiveHoldInterval;
    UINT64   MaxSleepIntervalExtension;
    UINT8    EponCapabilityExtension;
    UINT8    EponSetupExtension;
    UINT32   MissingConsecutiveBurstsThreshold;
} __attribute__((packed)) MIB_TABLE_ONU_DYNA_PWR_MGMT_CTRL_2014_T;

typedef struct {
    UINT16     EntityId;
    UINT8     PwrReductionMgmtCapability;
    UINT8     PwrReductionMgmtMode;
    UINT16     Itransinit;
    UINT16     Itxinit;
    UINT32     MaxSleepInterval;
    UINT32     MinAwareInterval;
    UINT16     MinActiveHoldInterval;
    UINT64     MaxSleepIntervalExtension;
} __attribute__((packed)) MIB_TABLE_ONU_DYNA_PWR_MGMT_CTRL_T;



#ifdef __cplusplus
}
#endif

#endif
